home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / cram32.zip / CRAM.DOC < prev    next >
Text File  |  1992-08-09  |  10KB  |  181 lines

  1. /*
  2.  *   ------------------------------------
  3.  *   C R A M   -   the ASCII file reducer
  4.  *   ------------------------------------
  5.  *
  6.  *   CRAM  -  ASCII File Reducer  - V3.2
  7.  *   Copyright (c) 1988-92  -  Dean Tutterow  -  All Rights Reserved
  8.  *   
  9.  *   What  does  it do?   It crams as  much text  as possible onto a page
  10.  *   in  reduced format.   Using  subscript characters as  the font on an
  11.  *   Epson printer,  you  can print up to 79 characters wide and 154 rows
  12.  *   long in 2 columns.   That  works  out to  5-6 pages of  text on each
  13.  *   printed  page.   In  normal use  with  files with embedded formfeeds
  14.  *   respected, you get 4 pages of text on each printed page.
  15.  *
  16.  *   CRAM also supports the HPLJ  and related printers.  Prior to release
  17.  *   V2.2, the file CRAM.DAT  would have to be  used to send the required
  18.  *   initialization and termination strings.  Version 2.2 has implemented
  19.  *   embedded HPLJ strings.  The current  functionality is to select font
  20.  *   number  1006  (6  point  font)  and  compute  the  appropriate  line
  21.  *   separation.  At  termination, font  number 1012  (12 point  font) is
  22.  *   selected and the line  separation is set to  6 lines per inch.  This
  23.  *   implementation is only an example of  what YOU can do.  I personally
  24.  *   do not use the  standard LJ fonts.  I  load three soft fonts, 1006 -
  25.  *   the 6 pt. font,  1012 - a 12  pt. default font, and  1024 - a 24 pt.
  26.  *   font.   If  you have  a  LJ  printer, change  the  initialization of
  27.  *   GLOBAL  symbol HPLJ  from 0 to  1.   Add in  YOUR initialization and
  28.  *   termination  strings  and  recompile!
  29.  *
  30.  *   CRAM  was  written  after  I  had  printed  another  of  those  LONG
  31.  *   documentation files.  I was tired of those STACKS of listings, etc.,
  32.  *   that  gathered  dust  simply  because they  were too much trouble to
  33.  *   handle  once I printed  them.   Now  the  printed listings are small
  34.  *   enough to keep in notebooks.   As a bonus, CRAM is especially useful
  35.  *   for printing program listings.  The reduced format is just the thing
  36.  *   to show program structure and the BIG picture!
  37.  *
  38.  *   While not limited to Epson printers,  it is hardcoded for my FX-86e.
  39.  *   Of course you can provide your own setup and un-setup codes for your
  40.  *   printer, and include them in a printer setup file for CRAM to use.
  41.  *
  42.  *   USAGE:
  43.  *   
  44.  *   CRAM srcfile crammedfile [/options]
  45.  *
  46.  *   where [/options] are:
  47.  *          /COLUMN=n       with 1 ≤ n ≤ 10
  48.  *          /DUAL           automatically format dual-sided pages
  49.  *          /EPSON          default printer
  50.  *          /EVEN           prints EVEN pages only
  51.  *          /FF             if <FF> encountered, align to next logical page
  52.  *          /HPLJ           select HPLJ printer
  53.  *          /LARGE          use PICA format to get 137 chars/line, EPSON only
  54.  *          /NONE           use to have CRAM function as a column program only
  55.  *          /ODD            prints ODD pages only
  56.  *          /PAGELENGTH=n   may vary printed page length from 1-154 lines
  57.  *          /SKIP=n         number of columns to ignore in srcfile
  58.  *          /TAB=n          number of columns representing a tab
  59.  *          /TEST           test the options on the srcfile, no output files
  60.  *          /WHITE=n        number of characters of whitespace on left of page
  61.  *          /WIDTH=n        width of CRAM's page, normally 160
  62.  *   
  63.  *   The  srcfile  should  be  a  valid DOS filename;  wildcards  are not
  64.  *   accepted.   You  need  only  supply  enough  to the  option  name to
  65.  *   distinguish it from the other options, for example /C=1 and /N.
  66.  *   
  67.  *   As a daily VAX user,  I  have tried to implement the straightforward
  68.  *   command-line interface that VMS affords the user.  While the srcfile
  69.  *   and crammedfile must be in that order,  the options may be spread at
  70.  *   will along the command line.
  71.  *
  72.  *   The options are much easier understood after a few practice sessions.
  73.  *   '/COLUMN=n' is  used whenever you want more or less than the standard
  74.  *   two columns on each page.   While  normally  defaulted  to two-column
  75.  *   operation, only the first 79 characters on each line (unless some are
  76.  *   /SKIP-ped) are  visible.   '/FF' respects  embedded  formfeeds in the
  77.  *   text.   Normally off, this option moves to the next logical page when
  78.  *   encountered.   The pagelength is adjustable  through  '/PAGELENGTH=n'
  79.  *   The default is 154 rows,  which allows two pages in each column since
  80.  *   most formatters place 66 lines per page.  If you want your one-column
  81.  *   printing shifted right on the page so that you have whitespace on the
  82.  *   left  side of the page,  then '/WHITE' is just the ticket.   Finally,
  83.  *   '/SKIP=n' ignores the first 'n' characters on each input line.   This
  84.  *   allows you to print 79 useful characters in each column when printing
  85.  *   formatted files  with spaces or tabs in the first 'n' columns.   It's
  86.  *   your job to try the rest.
  87.  */
  88.  
  89.         Helpful Hints:
  90.  
  91.         Okay, you have just un-zipped one of those shiny new programs
  92.         from the bulletin-board and you have this 80,000 byte file
  93.         describing all of it's features, called 'SHINY.DOC'.  The
  94.         first thing to do is scan the file to see it's general format.
  95.         The questions to ask yourself are as follows.
  96.  
  97.         "Are there embedded formfeeds?"
  98.                 If there are then you most likely will want to use
  99.                 the '/FF' option to align the pages.
  100.  
  101.         "Is there a set page length (usally 66 lines per page)?"
  102.                 Usually if a documentation file does not have embedded
  103.                 formfeeds, then it usually has a set page length.  While
  104.                 this is usually 66 lines per page, it could be some
  105.                 oddball number like 63.  For this case you would use the
  106.                 option '/PAGELENGTH=126' so that two pages will fit in
  107.                 each column.
  108.  
  109.         "Was the file created with some carriage returns not followed
  110.          by line feeds?"
  111.                 This is the case with document processors that implement
  112.                 overstrike and other printer features in a generic manner.
  113.                 They write out a second (and possibly more) line with the
  114.                 words they want to be overstruck.  Since there is no line
  115.                 feed after the first line, the printer writes over what it
  116.                 just printed.  These type of files make CRAM sick!  Never
  117.                 fear, FILTER is here.  Included in this distribution is
  118.                 the source and executable for FILTER, a program that removes
  119.                 these subsequent lines from the document so that CRAM can
  120.                 do it's job properly.  FILTER reads from STDIN and writes
  121.                 to STDOUT.
  122.  
  123.         "What do I do with documents spaced away from the left side of
  124.          the page?"
  125.                 If 'SHINY.DOC' is formatted so that the first character
  126.                 on every line starts after some position other than 1,
  127.                 the '/SKIP=n' option will allow you to ignore those first
  128.                 'n' characters on every line.  When reading lines in,
  129.                 CRAM converts all tabs to their appropriate space repre-
  130.                 sentation so need to worry about them either.  Using this
  131.                 option would allow you to see 'n' more characters in your
  132.                 printout
  133.  
  134.         "I don't have an Epson-compatible printer, am I out of luck?"
  135.                 For those of you that do not have an Epson-compatible
  136.                 printer, you may provide your own printer initialization
  137.                 and termination streams.  Simply create a file called
  138.                 'CRAM.DAT' with two lines.  The first line should contain
  139.                 the binary initialization stream and the second line the
  140.                 binary termination stream.  It is crude but effective.
  141.                 The printer initialization string sets the line spacing to
  142.                 15/216 inch, selects superscript mode, and finally selects
  143.                 condensed mode.  The printer termination string returns
  144.                 the printer to 1/6-inch line spacing, cancels superscript
  145.                 mode, cancels condensed mode, and finally writes an
  146.                 end-of-file character.  This is true only for the default
  147.                 EPSON printer.  You can of course place any streams you
  148.                 wish there.
  149.  
  150.  
  151.         I can't guarantee it, but I would wager that once you try CRAM
  152.         you will use it to print ALL your listings and documentation
  153.         files.  One nice benefit with printing in condensed superscript
  154.         mode is that no matter how bad your printer prints normally or
  155.         no matter how bad your ribbon, you WILL get a nice dark, readable
  156.         printing.  A number of people have even commented that it looks
  157.         like it came from a laser printer.
  158.  
  159.         I highly recommend using PKLITE, LZEXE, or any other executable
  160.         compressor with CRAM.  While the CRAM executable is not large,
  161.         we might as well get the benefit of these programs.  CRAM works
  162.         with both mentioned executable compressors.
  163.  
  164.         As an advocate of shareware in general and source distribution
  165.         in particular,   I am distributing  CRAM  with the stipulation
  166.         that NO  fee is charged  for the use, copying, or distribution
  167.         of CRAM.   I will gladly  accept contributions from those that
  168.         find my work of some use to them.  Please send any suggestions,
  169.         corrections, or contributions to the address given below.
  170.  
  171.         As always, this program is provided AS IS without any warranty,
  172.         expressed or implied, including but not limited to fitness for
  173.         a particular purpose.
  174.  
  175.  
  176.         DEAN TUTTEROW
  177.         4706 SANTA LUCIA DR.
  178.         WOODLAND HILLS, CA.  91364
  179.  
  180.         CompuServe - Send mail to [76326,170].
  181.